package com.ruoyi.common.utils.checkSql;

import org.springframework.jdbc.datasource.lookup.AbstractRoutingDataSource;

/**
 * AUTHOR : CREATED BY DALE MAO ON 2018/6/27
 * DESCRIPTION:
 * Time:2018/6/27 ----- ${Time}
 **/
public class MultipleDataSource extends AbstractRoutingDataSource {


    private static final ThreadLocal<String> dataSourceKey = new InheritableThreadLocal<String>();

    public static void setDataSourceKey(String dataSource){
        dataSourceKey.set(dataSource);
    }

    @Override
    protected Object determineCurrentLookupKey() {
        return dataSourceKey.get();
    }

}


